package zjut.raymond.common;


/**
 * API接口响应内容封装
 *
 */

public class ApiResult<T> {
    private int code;
    private String message;
    private T data;

    public ApiResult() {
    }

    public ApiResult(ApiCode apiCode, T data) {
        this.code = apiCode.getCode();
        this.message = apiCode.getMessage();
        this.data = data;
    }

    public ApiResult(ApiCode apiCode, String description, T data) {
        this.code = apiCode.getCode();
        this.message = apiCode.getMessage() + (description != null ? "【" + description + "】" : "");
        this.data = data;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }
}
